package com.cxg.fairy.app;

import android.content.Context;
import android.os.Handler;

import java.util.WeakHashMap;

/**
 * Created by Administrator on 2017/10/16.
 */

public final class Fairy {

        public static Configurator init(Context context){
            Configurator.getInstance()
                    .getFairyConfigs()
                    .put(ConfigType.APPLICATION_CONTEXT,context.getApplicationContext());
            return Configurator.getInstance();
        }

        public static Configurator getConfigurator() {
            return Configurator.getInstance();
        }

        public static <T> T getConfiguration(Object key) {
            return getConfigurator().getConfiguration(key);
        }

        public static Context getApplicationContext() {
            return getConfiguration(ConfigType.APPLICATION_CONTEXT);
        }

        public static Handler getHandler() {
            return getConfiguration(ConfigType.HANDLER);
        }

}
